<style scoped>
  .weui-form-preview {
    background-color: #fff;
    margin: 5px;
    border-radius: 5px;
  }
  .weui-form-preview__hd label, .weui-form-preview__hd em {
    font-size: .9em !important;
  }
  .rj-cell {
    display: inline-block;
    font-size: 0;
    padding: 5px 15px;
  }
  .rj-cell.max span{
    font-size: 16px;
    padding-right: 20px;
  }
  .rj-cell.minpad{
    padding-right: 10px !important;
  }
  .rj-cell label {
    color: #333;
    font-size: 14px;
  }
  .rj-cell span {
    padding-left: 5px;
    font-size: 14px;
    color: #333;
  }
  .rj-cell.note{
    width: 100%;
  }
  .rj-cell.note label{
    float: left;
  }
  .rj-cell.note span{
    width: 80%;
    display: inline-block;
  }
  .rj-wrap {
    background: #eee;
    overflow:auto;overflow-x: hidden
  }
  .weui-panel {
    background: #eee;
  }
  .rj-cont-tit {
    margin: 0;
    border-radius: 0;
  }
  .weui-panel {
    margin-top: 0;
    text-align: left;
  }
  .tit label, .tit span {
    font-size: 16px;
  }
  .tit label {
    padding-right: 20px;
  }
  .weui-panel.weui-panel_access {
    padding-bottom: 10px;
  }
  .weui-panel__bd:not(.base) {
    width: 98%;
    padding: 0 1% 2px 1%;
  }
  .rj-cont-tit:not(.base) {
    border-radius: 5px;
  }
  #acts span {
    font-size: 14px;
  }
  .viewpage {
    height: 100%;
    background: #eee;
  }
</style>
<template>
  <div class="viewpage">
    <div class="rj-wrap">
<!--      <div class="logsbtn" @click="openLogs"><img src="@/assets/icon-history.png" style="width: 20px" /></div>-->
       合同价格调整详情
      <a href="javascript:;" @click="$router.back(-1)" style="position: absolute; left: 10px; top: 8px">
        <img src="@/assets/back.png" style="width: 20px" />
      </a>
    </div>
    <div class="weui-panel weui-panel_access">
      <div class="weui-panel__bd base" style="border-bottom: 2px solid #fff;">
        <div class="weui-form-preview billitem rj-cont-tit base">
          <div class="rj-cell max">
            <label>编号：</label>
            <span>{{baseInfo.code}}</span>
          </div>
          <div class="rj-cell max">
            <label>合同：</label>
            <span>{{baseInfo.contractname}}</span>
          </div>
          <div class="rj-cell max">
            <label>种植户：</label>
            <span>{{baseInfo.grower}}</span>
          </div>
          <div class="rj-cell max">
            <label>产品：</label>
            <span>{{baseInfo.productname}}</span>
          </div>
          <div>
            <div class="rj-cell max" v-if="baseInfo.spename != ''">
              <label>修改前规格：</label>
              <span>{{baseInfo.preSpename}}</span>
            </div>
            <div class="rj-cell max" v-if="baseInfo.spename != ''">
              <label>规格：</label>
              <span>{{baseInfo.spename}}</span>
            </div>
          </div>
          <div>
            <div class="rj-cell max" v-if="baseInfo.price != ''">
              <label>修改前单价：</label>
              <span>{{baseInfo.previousprice}}</span>
            </div>
            <div class="rj-cell max" v-if="baseInfo.price != ''">
              <label>单价：</label>
              <span>{{baseInfo.price}}</span>
            </div>
          </div>
          <div class="rj-cell max" v-if="baseInfo.isdiscount != ''">
            <label>修改前扣杂标准：</label>
            <span>{{getIsdiscTypeName(baseInfo.preIsdiscount)}}</span>
          </div>
          <div class="rj-cell max" v-if="baseInfo.isdiscount != ''">
            <label>扣杂标准：</label>
            <span>{{getIsdiscTypeName(baseInfo.isdiscount)}}</span>
          </div>
          <div>
            <div class="rj-cell max" v-if="baseInfo.discountrate != ''">
              <label>修改前扣杂率(%)：</label>
              <span>{{baseInfo.preDiscountrate}}</span>
            </div>
            <div class="rj-cell max" v-if="baseInfo.discountrate != ''">
              <label>扣杂率(%)：</label>
              <span>{{baseInfo.discountrate}}</span>
            </div>
          </div>
          <div class="rj-cell max">
            <label>申请人：</label>
            <span>{{baseInfo.operator}}</span>
          </div>
          <div class="rj-cell max">
            <label>备注：</label>
            <span>{{baseInfo.remark}}</span>
          </div>
          <div class="rj-cell max">
            <label>创建日期：</label>
            <span>{{baseInfo.createtime}}</span>
          </div>
        </div>
      </div>
    </div>
    <OperationLogs2 :orderid="id" :srguid="''" :departid="''"></OperationLogs2>
  </div>
</template>

<script>
  import OperationLogs2 from '../common/OperationLogs2'

  export default {
  name: 'ViewScrap',
  data () {
    return {
      id: '',
      baseInfo: {},

    }
  },
  components: {
    OperationLogs2
  },
  created() {

  },
  mounted () {

    this.id = this.$route.query.id;
    this.getBaseInfo(this.id);

  },
  methods: {
    getIsdiscTypeName: function(val) {
      let name = '';
      switch (val) {
        case 1:
          name = '按照合同约定的扣杂率扣杂';
          break;
        case 2:
          name = '按照质检结果扣杂';
          break;
        case 3:
          name = '合同和质检结果取最大扣杂';
          break;
        case 4:
          name = '按质检结果分级扣杂';
          break;
      }
      return name;
    },
    getBaseInfo: function (id) {
      this.axios({
        method: 'get',
        url: '/harvest/EditContractprice!detail.action',
        params: {editContractid: id}
      }).then(response => {
        if (response.data.msg == 'success') {
          let data = response.data;
          this.baseInfo = data.editcontractprice;
        } else if (response != undefined && response.data != undefined && response.data.msg == 'sessionTimeOut') {
          //不不设置提示
        } else {
          this.toastError('系统错误');
        }
      });
    },
    openLogs: function() {
      this.$router.push({name: 'OperationLogs2', query: {orderid: this.id, srguid: '', departid: ''}});
    }
  }
}
</script>
